package cn.exrick.xboot.common.qywxCode.Security.service.impl;

import cn.exrick.xboot.common.qywxCode.Security.service.MyUserDetailsService;
import cn.exrick.xboot.config.security.SecurityUserDetails;
import cn.exrick.xboot.modules.base.entity.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

@Service
public class MyUserDetailsServiceImpl implements MyUserDetailsService {
    @Override
    public UserDetails loadUserByUsername(User user) throws UsernameNotFoundException {
        if(user == null){
            throw new UsernameNotFoundException("User实体为空");
        }
         return new SecurityUserDetails(user);
    }
}
